/**
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-11-24 22:18:21
 * Copyright (c) 2015- joysuch-版权所有
 */
package com.joysuch.wwyt.risk.repository;

import com.joysuch.wwyt.risk.entity.RiskPointEvaluationJhaItem;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;


/**
 * RiskPointEvaluationJhaItemDao
 *
 */
public interface RiskPointEvaluationJhaItemDao extends JpaRepository<RiskPointEvaluationJhaItem, Long> {
    public Page<RiskPointEvaluationJhaItem> findAll(Specification<RiskPointEvaluationJhaItem> spec, Pageable pageable);

    public RiskPointEvaluationJhaItem save(RiskPointEvaluationJhaItem bean);

    public void delete(RiskPointEvaluationJhaItem bean);

    //@Query(value = "select * from RiskPointEvaluationJhaItem where jhaEvaluationId = ?1 order by id desc limit 1")
    @Query(value = "SELECT * FROM `wwyt_risk_point_evaluation_jha_item` WHERE JHA_EVALUATION_ID = ?1 ORDER BY id DESC LIMIT 1",nativeQuery = true)
    public List<RiskPointEvaluationJhaItem> findByJhaEvaluationId(Long id);


}
